#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N = 8010;
const int inf = 0x7fffffff;

int a[N], b[N];

int main(){
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	int n, q;
	cin >> n >> q;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	
	for(int i = 1; i <= q; i++){
		int flag;
		cin >> flag;
		if(flag == 1){
			//cout << "flag is 1" << endl;
			int x, v;
			cin >> x >> v;
			a[x] = v;
		}
		else{
			//cout << "flag is 2" << endl;
			int x;
			cin >> x;
			for(int i = 1; i <= n; i++){
				b[i] = a[i];
			}
			int p = x;
			for(int k = n; k >= 1; k--){
				int ys = 1;
				for(int j = 1; j <= k-1; j++){
					if(b[j] > b[j+1]){
						ys = j+1;
						int t = b[j];
						b[j] = b[j+1];
						b[j+1] = t;
						if(j == p) p = j+1;
						if(j+1 == p) p = j;
					}
				}
				if(ys == 1) break;
			}
			cout << p << endl;
		}
		
	}
	return 0;
} 
